package gttp.nspa.shared.om;

import com.google.gwt.user.client.rpc.IsSerializable;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Index;
import com.googlecode.objectify.condition.IfNotNull;

@Entity(name = "CUST")
public class Customer implements IsSerializable {

    @Id
    private Long   id;

    @Index(IfNotNull.class)
    private String name;

    @Index(IfNotNull.class)
    private String address;

    @Index(IfNotNull.class)
    private String phone;

    @Index(IfNotNull.class)
    private String email;

    @Index(IfNotNull.class)
    private Long   createdTime = System.currentTimeMillis();

    @Index
    private long   lastVisit;

    public Long getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Long getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Long createdTime) {
        this.createdTime = createdTime;
    }

    public long getLastVisit() {
        return lastVisit;
    }

    public void updateLastVisit() {
        lastVisit = System.currentTimeMillis();
    }

    public Customer getSelf() {
        return this;
    }

}
